from datetime import datetime
from django.db import models
from django.contrib.auth.models import User

class ElectionManager(models.Manager):
    def active(self):
        return self.filter(active=True)

class Election(models.Model):
    active = models.BooleanField(default=True)
    name = models.CharField(max_length=128)
    slug = models.SlugField(unique=True)
    content = models.TextField(help_text='Use <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> or HTML for formatting.')
    create_date = models.DateTimeField(auto_now_add=True)

    objects = ElectionManager()

    def __unicode__(self):
        return self.name
